<!DOCTYPE html>
<html lang="en">
<!--头部信息-->
<head>
    <meta charset="utf-8">
    <title>待审判</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">

    <script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
</head>
<!--待审判-->
<body>
<div class="layuimini-container">
    <div class="layuimini-main">


        <!--搜索框-->
        <fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                <div class="layui-form layui-form-pane">
                    <div class="layui-form-item common" id="seach">


                        <!--姓名-->
                        <div class="layui-inline">
                            <label class="layui-form-label">姓名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" id="username" autocomplete="off" class="layui-input">
                            </div>
                        </div>


                        <!--死亡时间-->
                        <div class="layui-inline">
                            <label class="layui-form-label">死亡时间</label>
                            <div class="layui-input-inline">
                                <input type="text" name="date" id="date" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>


                        <!--搜索按钮-->
                        <div class="layui-inline" style="padding-left: 5px">
                            <button class="layui-btn layui-btn-primary" data-type="reload" id="search"><i class="layui-icon"></i> 搜 索
                            </button>
                        </div>


                    </div>
                </div>
            </div>
        </fieldset>

        <!--表头操作-->
        <script type="text/html" id="toolbarDemo">
            <div class="layui-btn-container">
            </div>
        </script>


        <!--创建表格-->
        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>


        <!--表内操作-->
        <script type="text/html" id="currentTableBar">
            <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">判官审判</a>
        </script>


    </div>
</div>
<script>
    layui.use(['form', 'table', 'jquery', 'layer', 'laydate'], function () {
        var $ = layui.jquery,
            form = layui.form,
            layer = layui.layer,
            laydate = layui.laydate,
            table = layui.table;


        /*表格数据渲染*/
        table.render({
            elem: '#currentTableId',
            url: '/getDspList',
            toolbar: '#toolbarDemo',
            cellMinWidth: 50,
            height: 440,
            limit: 8,
            limits: [8, 16, 24, 32, 40],
            method: 'GET',
            text: {
                none: '暂时没有数据哦！'
            },
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '待审判表格数据',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [
                [
                    {type: 'numbers', width: 50, title: '序号', align: "center"}
                    , {field: 'fid', hide: true, width: 80, title: '主ID', sort: true, align: "center"}
                    , {field: 'ffid', hide: true, width: 80, title: '用户ID', sort: true, align: "center"}
                    , {field: 'fname', title: '姓名', align: "center"}
                    , {field: 'fsex', title: '性别', align: "center"}
                    , {
                    field: 'fcurrentAge', title: '年龄', sort: true, align: "center", templet: function (d) {
                        return d.fcurrentAge += "岁";
                    }
                }, {
                    field: 'fcountAge', title: '总寿命', hide: true, sort: true, align: "center", templet: function (d) {
                        return d.fcurrentAge += "岁";
                    }
                }
                    , {field: 'ftype', title: '类别', width: 100, hide: true, align: "center"}
                    , {field: 'farea', title: '地区', width: 100, align: "center"}
                    , {
                    field: 'fstatus', title: '勾魂状态', hide: true, width: 100, align: "center", templet: function (d) {
                        if (d.fstatus === 1) {
                            return "未勾魂";
                        } else {
                            return "已勾魂";
                        }
                    }
                }
                    , {field: 'fdieWhy', title: '死因', width: 120, align: "center"}
                    , {
                    field: 'freincarnation', title: '前世', align: "center", templet: function (d) {
                        if (d.freincarnation === null || d.freincarnation === '') {
                            return "无";
                        } else {
                            return d.freincarnation;
                        }
                    }
                }
                    , {
                    field: 'spzt', title: '审判状态', hide: true, width: 120, align: "center", templet: function (d) {
                        if (d.spzt === 1) {
                            return "未审判";
                        } else {
                            return "已审判";
                        }
                    }
                }
                    , {field: 'fdesc', title: '描述', hide: true, align: "center"}
                    , {field: 'flassTime', hide: true, width: 150, title: '最后编辑时间', sort: true, align: "center"}
                    , {field: 'fdieTime', width: 180, title: '死亡时间', sort: true, align: "center"}
                    , {field: 'ffpr', title: '分配人', hide: true, align: "center"}
                    , {field: 'ftime', width: 180, title: '分配时间', hide: true, sort: true, align: "center"}
                    , {fixed: 'right', title: '操作', minWidth: 120, toolbar: '#currentTableBar', align: "center"}
                ]
            ],
            page: true,
            id: "testId"
        });

        //日期
        laydate.render({
            elem: '#date'
        });


        /*搜索事件处理*/
        $('#search').click(function () {
            var username = $('#username').val(),
                date = $("#date").val(),
                statu = $("#statu").val();
            /*表格重载*/
            table.reload('testId', {
                page: {
                    curr: 1
                },
                where: {
                    username: username,
                    date: date
                }
            }, 'data');
        });


        /*表内操作事件处理*/
        table.on('tool(currentTableFilter)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {
                var index = layer.open({
                    title: '审判详情',
                    type: 2,
                    shade: 0.2,
                    maxmin: true,
                    shadeClose: true,
                    area: ['85%', '95%'],
                    content: '/trialdetails',
                    success: function (layero, index) {
                        var body = layer.getChildFrame('body', index);
                        var iframeWin = window[layero.find('iframe')[0]['name']];
                        /*数据传递*/
                        body.find('#datas').val(data.fid);
                        body.find('#fcountAge').val(data.fcountAge);
                        body.find('#fcurrentAge').val(data.fcurrentAge);
                        body.find('#ffid label').text(data.ffid);
                        body.find('#fname label').text(data.fname);
                        body.find('#fdieWhy label').text(data.fdieWhy);
                        body.find('#fdieTime label').text(data.fdieTime);
                    }
                });
                $(window).on("resize", function () {
                    layer.full(index);
                });
                return false;
            }
        });
    });
</script>

</body>
</html>